In known arithmetic units, it is possible to calculate a multiply accumulate function. In a multiply accumulate function, a first number X is multiplied by a second number Y and added to an accumulator ACCU. This function may be repeated a number of times to modify each time the value of the accumulator ACCU. In mathematical notation, the result RES of this function can be represented as follows:RES=ACCU+X*Y
In the next operation which is performed, ACCU will equal the result RES obtained by carrying out the preceding function.
Reference is made to FIG. 1 which shows a known arithmetic unit 2 which performs a multiply accumulate function. The unit 2 generates n partial products 4. The current accumulator ACCU is stored in the accumulator register 6. The partial products 4 along with the output from the accumulator register 6 are input to a carry save adder 8. The carry save adder 8 reduces the number of partial products and the output of the accumulator register 6 to two partial products. In other words, the N+1 inputs to the carry save adder 8 are reduced to two. These two partial products are output to a final adder 10 which adds together the two partial products to provide the final result RES.
In the arrangement shown in FIG. 1, it is possible to perform a carry save operation in the carry save adder 8 on the partial products and the contents of the accumulator register 6 at the same time. X*Y is equal to the sum of all of the partial products P0 to P(n−1). In other words X*Y=ΣPi for i=0, 1 . . . n−1. Thus, RES=ACCU+ΣPi. As shown by this equation, all the partial products and the accumulator ACCU are added together in order to obtain the result RES.
It is also desirable in certain circumstances to be able to perform a multiply subtract operation. In this operation, a first number X is multiplied by a second number Y and subtracted from a accumulator ACCU (which in fact may be modified by subsequent operations) to provide the result RES. In mathematical notation, RES=ACCU−X*Y. Again, X*Y can be determined by adding together the n partial products. Accordingly, RES=ACCU−ΣPi. The architecture shown in FIG. 1 is not suitable for use with a multiply subtract operation. This is because the partial products and accumulator ACCU cannot simply be added together to provide the result RES. Some additional circuitry will therefore be required in order to allow a multiply subtract operation to be performed as well as a multiply accumulate function. This additional circuitry would inevitably result in an increase in the time taken to complete an operation.